from typing import Dict, List
from pyscrcpy import Client

class ClientManager:
    def __init__(self):
        self.clients: Dict[str, Client] = {}
        
    def add_client(self, device_id: str, max_fps: int = 20, max_size: int = 900) -> bool:
        """添加一个新的手机客户端"""
        if device_id in self.clients:
            return False
            
        client = Client(max_fps=max_fps, max_size=max_size)
        self.clients[device_id] = client
        return True
        
    def remove_client(self, device_id: str) -> bool:
        """移除一个手机客户端"""
        if device_id not in self.clients:
            return False
            
        client = self.clients.pop(device_id)
        client.stop()
        return True
        
    def get_all_clients(self) -> List[str]:
        """获取所有客户端ID列表"""
        return list(self.clients.keys())
        
    def get_client(self, device_id: str) -> Client:
        """获取指定客户端"""
        return self.clients.get(device_id)